package com.qf.cosmetology.controller;

import com.qf.cosmetology.entity.Order;
import com.qf.cosmetology.result.ResponseData;
import com.qf.cosmetology.service.OrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Order)表控制层
 *
 * @author makejava
 * @since 2021-06-22 11:14:14
 */
@RestController
@RequestMapping("orders")
public class OrderController {
    /**
     * 服务对象
     */
    @Resource
    private OrderService orderService;


    @ApiOperation(value = "insertOrder",notes = "添加预约记录")
    @ApiImplicitParam(name="order",value = "预约对象")
    @PostMapping("/")
    public ResponseData  insertOrder(@RequestBody Order order){
        return orderService.insert(order);
    }

    @ApiOperation(value = "getDayOrderCount",notes = "查询当天订单总数")
    @GetMapping("/getDayOrderCount")
    public Integer getDayOrderCount(){
        return orderService.getDayOrderCount();
    }

    @ApiOperation(value = "getWeekOrderCount",notes = "查询一周内订单总数")
    @GetMapping("/getWeekOrderCount")
    public Integer getWeekOrderCount(){
        return orderService.getWeekOrderCount();
    }

    @ApiOperation(value = "getMonthOrderCount",notes = "查询当月订单总数")
    @GetMapping("/getMonthOrderCount")
    public Integer getMonthOrderCount(){
        return orderService.getMonthOrderCount();
    }
    @ApiOperation(value = "getYearOrderCount",notes = "查询一年内订单总数")
    @GetMapping("/getYearOrderCount")
    public Integer getYearOrderCount(){
        return orderService.getYearOrderCount();
    }


}
